
template <class T, int D>
class Vec{
public:
    T myvec[D];
    
    Vec(){
        for(int i = 0;i < D;i++)
            myvec[i] = 0;
    }
    Vec(T *a){
        for(int i = 0;i < D;i++)
            myvec[i] = a[i];
    }
    Vec(const Vec<T,D> &rhs){
        for(int i = 0;i < D;i++)
            myvec[i] = rhs[i];
    }
    T &operator[](int d){ return myvec[d];}
    const T &operator[](int d) const { return myvec[d];}

    Vec operator+(const Vec<T,D> &rhs) const{
        Vec<T,D> r;
        for(int i = 0;i < D;i++)
            r[i] = myvec[i] + rhs[i];
        return r;
    }
    Vec operator-(const Vec<T,D> &rhs) const{
        Vec<T,D> r;
        for(int i = 0;i < D;i++)
            r[i] = myvec[i] - rhs[i];
        return r;
    }
    Vec operator*(const double coff) const{
        Vec<T,D> r;
        for(int i = 0;i < D;i++)
            r[i] = myvec[i] * coff;
        return r;
    }
    Vec operator/(const double coff) const{
        Vec<T,D> r;
        for(int i = 0;i < D;i++)
            r[i] = myvec[i] / coff;
        return r;
    }
};
